function init(baseInfoJson,respondDataJson){
	var basePath = $("#basePath").val();
	
	if(respondDataJson){
		if(respondDataJson.success==false){
			layer.msg('添加数据失败');
		}
	}
	
	$("select").each(function(){
		$(this).append("<option value=''>---请选择---</option>");
	});
	
	
	var sexs = baseInfoJson['sexs'];
	$(".sex").each(function(){
		var options = "";
		for(var index in sexs){
			var sex = sexs[index];
	    	options+="<option value='"+sex.uniq_code+"'>"+sex.label+"</option>"
	    };
	    $(this).append(options);
	});
	
	var medicalDepts = baseInfoJson['medicalDepts'];
	$(".medicalDept").each(function(){
		var options = "";
		for(var index in medicalDepts){
			var medicalDept = medicalDepts[index];
	    	options+="<option value='"+medicalDept.uniq_code+"'>"+medicalDept.label+"</option>"
	    };
	    $(this).append(options);
	});
	
	
	var outHospitalTypes = baseInfoJson['outHospitalTypes'];
	$(".outHospitalType").each(function(){
		var options = "";
		for(var index in outHospitalTypes){
			var outHospitalType = outHospitalTypes[index];
	    	options+="<option value='"+outHospitalType.uniq_code+"'>"+outHospitalType.label+"</option>"
	    };
	    $(this).append(options);
	});
	
	$.each($("select"),function(i,item) {
		$(item).change(function(){
	   		var eventObj = $(this);
	   		var nameObjName = eventObj.attr("name").replace("Code", "Name");
	   		
	   		if(eventObj.val()!=""){
	   			var name=eventObj.find("option:selected").text();
	   			eventObj.next("input[name='"+nameObjName+"']").val(name);
	   		}else{
	   			eventObj.next("input[name='"+nameObjName+"']").val("");
	   		}
	   	});
		
	});
	var data = respondDataJson.data;
	$("input[name='patientName']").val(data.patientName);
	$("input[name='idNumber']").val(data.idNumber);
	$("input[name='birthday']").val(data.birthday);
	$("input[name='mrId']").val(data.mrId);
	$("input[name='onlyId']").val(data.onlyId);
	$("input[name='outHospitalDateTime']").val(data.outHospitalDateTime);
	var sexOjb = $("select[name='sexCode']");
	if(data.sexCode){
		
		var selectOption = sexOjb.find("option[value='"+data.sexCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}
	};
	sexOjb.next("input[name='"+sexOjb.attr("name").replace("Code", "Name")+"']").val(data.sexName);
	
	var outDeptOjb = $("select[name='outDeptCode']");
	if(data.outDeptCode){
		
		var selectOption = outDeptOjb.find("option[value='"+data.outDeptCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}
	};
	outDeptOjb.next("input[name='"+outDeptOjb.attr("name").replace("Code", "Name")+"']").val(data.outDeptName);
	
	var outHospitalTypeOjb = $("select[name='outHospitalTypeCode']");
	if(data.outHospitalTypeCode){
		
		var selectOption = outHospitalTypeOjb.find("option[value='"+data.outHospitalTypeCode+"']")
		if(selectOption.length > 0){
			selectOption.attr("selected",true);
		}
	};
	outHospitalTypeOjb.next("input[name='"+outHospitalTypeOjb.attr("name").replace("Code", "Name")+"']").val(data.outHospitalTypeName);
	
}
function createFormSubmit(){
	$("#createForm").submit();
}

